import request from '@/utils/request'

// 用户头像相关API
export const userAvatarApi = {
  // 上传头像
  uploadAvatar: (formData) => {
    return request({
      url: '/api/user/avatar/upload',
      method: 'POST',
      data: formData,
      headers: {
        'Content-Type': 'multipart/form-data'
      }
    })
  },
  
  // 获取用户头像历史
  getAvatarHistory: () => {
    return request({
      url: '/api/user/avatar/history',
      method: 'GET'
    })
  },
  
  // 设置默认头像
  setDefaultAvatar: (avatarId) => {
    return request({
      url: '/api/user/avatar/default',
      method: 'PUT',
      data: { avatarId }
    })
  },
  
  // 获取预设头像列表
  getPresetAvatars: () => {
    return request({
      url: '/api/user/avatar/presets',
      method: 'GET'
    })
  },
  
  // 删除头像
  deleteAvatar: (avatarId) => {
    return request({
      url: `/api/user/avatar/${avatarId}`,
      method: 'DELETE'
    })
  }
}